﻿Imports VN.INS.BL.BC
Imports System.Data

Partial Class Devida_ConfigAno
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Not (Page.IsPostBack)) Then
            Dim objGeneral As GeneralBC
            Dim objDt As DataTable
            Try
                objGeneral = New GeneralBC
                objDt = New DataTable

                'cargamos los años al combo 
                objDt = objGeneral.ListaTablaGeneral("ANHIO")
                ddlAno.DataSource = objDt
                ddlAno.DataTextField = "DESCRIPCION"
                ddlAno.DataValueField = "CODIGO"
                ddlAno.DataBind()

                ddlAno.SelectedValue = Session("Año")

            Catch ex As Exception
                Throw ex
            End Try
        End If
    End Sub

    Protected Sub btnActivar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnActivar.Click
        'Capturamos el año seleccionado
        Session("Año") = ddlAno.SelectedValue.ToString    
        alerta.Mostrar_Alerta("Aviso", "Se activo el año " + Session("Año").ToString)
        Response.Redirect("Inicio.aspx")

    End Sub

    'salir
    Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnsalir.Click
        Response.Redirect("Inicio.aspx")
    End Sub
End Class
